<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
<script src="../js/echarts.min.js"></script>
</head>
<body>
    <!-- 为ECharts准备一个具备大小（宽高）的Dom -->
    <div id="main" style="width: 600px;height:400px;"></div>
    <div id="main1" style="width: 600px;height:400px;"></div>
    <script type="text/javascript">
        // 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById('main'));
        var myChart1 = echarts.init(document.getElementById('main1'));
        
        // 指定图表的配置项和数据
        var option = {
            title: {
                text: 'ECharts rumen'
            },
            tooltip: {},
            legend: {
                data:['xiangliang2']
            },
            xAxis: {
                data: ["chenshan","yangmao","xuerong","kuzi","gaigeng","wazi"]
            },
            yAxis: {},
            series: [{
                name: 'xiangliang2',
                type: 'bar',
                data: [5, 20, 36, 10, 10, 20]
            }]
        };

        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);

        $.get('analysiswork?ActionType=analysis',function(USERINFO) {//与服务器连接成功
            console.log(USERINFO);//获取到的json数据是个对象
            myChart1.setOption(option = {
                title:{
                    text:'ECharts 异步加载数据'
                },
                tooltip:{},
                legend:{
                    data:['访问量']
                },
                 xAxis:{
                    data:USERINFO.deptName
                },
                yAxis:{},
                series:[
                    {
                        name:'访问量',
                        type:'line',
                        data:USERINFO.userCode
                    }
                ]
            });
        });
    </script>
</body>
</html>